﻿#include "XQPushUser.h"
#include"XSymbolOverload.h"
#include"XQAlgorithm.h"
int XQPushVerify::m_mesc=5_mins;
bool XQPushVerify::isTimeout() const
{
    if (m_timeout.isNull())
        return true;
    if(m_timeout<QDateTime::currentDateTime())
        return true;
    return false;
}

QDateTime XQPushVerify::timeout() const
{
    return m_timeout;
}

QReadWriteLock* XQPushVerify::lock() 
{
    return &m_lock;
}

int XQPushVerify::verify() const
{
    return m_verify;
}

int XQPushVerify::newVerify()
{
    m_verify= random(100000,999999);
    //刷新时间
    m_timeout = QDateTime::currentDateTime().addMSecs(m_mesc);
    return verify();
}

XQPushVerify::XQPushVerify()
{

}